// components/hot-list/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        banner: Object
    },

    /**
     * 新式监听器，监听属性变化
     */
    observers: {
        'banner': function (banner) {
            if (!banner) {
                return
            }
            if (banner.items.length === 0) {
                return
            }
            const bannerImg = banner.img
            const leftItem = banner.items.find(i => i.name === 'left')
            const rightTopItem = banner.items.find(i => i.name === 'right-top')
            const rightBottomItem = banner.items.find(i => i.name === 'right-bottom')
            this.setData({
                bannerImg,
                leftItem,
                rightTopItem,
                rightBottomItem
            })
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        bannerImg: '',
        leftItem: null,
        rightTopItem: null,
        rightBottomItem: null
    },

    /**
     * 组件的方法列表
     */
    methods: {}
})
